package main.java.com.uc.training.smadmin.gds.dao.impl;

import com.uc.training.smadmin.gds.dao.CommentReplyDao;
import com.uc.training.smadmin.gds.model.CommentReply;
import com.uc.training.smadmin.gds.re.CommentReplyRE;
import com.uc.training.smadmin.gds.vo.CommentReplyVO;
import com.zuche.framework.dao.CarIsIbatisDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 版权声明： Copyright (c) 2008 ucarinc. All Rights Reserved.
 *
 * @author 何麒（qi.he@ucarinc.com）
 * @Version 1.0
 * @date 2018/11/17
 */
@Repository
public class CommentReplyDaoImpl extends CarIsIbatisDaoImpl implements CommentReplyDao {

    private static final String NAMESPACE = "com.uc.training.smadmin.gds.dao.CommentReplyDao.";

    /**
     * 获取评论的后台回复
     *
     * @param commentId
     * @return
     */
    @Override
    public String getAdminReplyContent(Long commentId) {
        return (String) this.queryForObject(NAMESPACE + "getAdminReplyContent", commentId);
    }

    /**
     * 根据评论id获取评论回复信息
     *
     * @param commentReplyVO
     * @return
     */
    @Override
    public List<CommentReplyRE> getCommentReplyList(CommentReplyVO commentReplyVO) {
        return this.queryForList(NAMESPACE + "getCommentReplyList", commentReplyVO);
    }

    /**
     * 新增商品详情回复
     *
     * @param commentReply
     * @return
     */
    @Override
    public Long insertCommentReply(CommentReply commentReply) {
        return (Long) this.insert(NAMESPACE + "insertCommentReply", commentReply);
    }

    /**
     * 删除商品详情回复
     *
     * @param commentReplyVO
     * @return
     */
    @Override
    public Integer deleteCommentReplyById(CommentReplyVO commentReplyVO) {
        return this.deleteObject(NAMESPACE + "deleteCommentReplyById", commentReplyVO);
    }

    @Override
    public Integer editAdminReplyContent(CommentReply commentReply) {
        return (Integer)this.update(NAMESPACE+"editAdminReplyContent",commentReply);
    }
}
